//+------------------------------------------------------------------+
//|                    Martingale base on camarilla pivot points.mq4 |
//|                                                      John Taylor |
//|                http://financialprogrammingservices.blogspot.com/ |
//|                                                                  |
//| This EA has 2 modes opens a grid of orders and trades price      |
//| retracement.                                                     |
//| In Automatic mode (Manual=FALSE), the EA uses Camarilla pivots   |
//| points to set up a grid of BUY LIMIT orders starting at S3 and a |
//| grid of SELL LIMIT orders starting at R3.                        |
//|                                                                  |
//| In Manual Mode (Manual=TRUE), the EA uses a manual start buy     |
//| (ManStartBuyPrice>0) to set up the BUY LIMIT orders, and a manual|
//| start sell price (ManStartSellPrice>0) to set up the SELL LIMIT  |
//| orders.                                                          |
//|                                                                  |
//| If the flag AutoOpenDaily is set to TRUE, then orders are opened |
//| as soon as possible after a time specified by the EndHour        |
//| external input.                                                  |
//|                                                                  |
//| If Endhour is non-zero then no grid will be set up after this    |
//| time.                                                            |
//|                                                                  |
//| The further the orders are placed from the pivots, the lots are  |
//| increased. The first 2 orders are set according to StartLots,    |
//| subsequent lots are doubled, e.g. 0.1,0.1,0.2,0.4 etc.           |
//| This is a Martingaling system.                                   |
//|                                                                  |
//| If TPMultplier is set to any value above 1.0, then orders in the |
//| outer half of the grid will have their spacing successively      |
//| widened by that amount. e.g. for 8 orders,20 pips start grid, and|
//| TPMultiplier of 1.1 you will get a spacing of                    |
//| 20,20,20,20,22,24,26,29.                                         |
//|                                                                  |
//| If the price goes against us such that the outer order has a loss|
//| exceeding one grid width, then all open trades are closed.       |
//+------------------------------------------------------------------+
